/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.partaljevic.tapestry.gambling.pages;

import com.partaljevic.gambling.Customer;
import com.partaljevic.gambling.Identifiable;
import com.partaljevic.tapestry.gambling.service.Customers;
import com.partaljevic.tapestry.gambling.service.TicketService;
import org.apache.tapestry5.Block;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

/**
 *
 * @author Danilo
 */
public class ViewTickets {

    @Property
    private Customer currentCustomer;
    @Inject
    private Customers customers;
    @Property
    @Inject
    private TicketService tickets;
    @Property
    private com.partaljevic.gambling.beans.Ticket ticket;
    @Property
    @Inject
    private Block viewAll;
    @Property
    @Inject
    private Block onlyWinning;

    public void onActivate(long id) {
        currentCustomer = customers.retrieve(id);
    }

    public long getID() {
        return Identifiable.class.cast(currentCustomer).getID();
    }

    public long onPassivate() {
        return Identifiable.class.cast(currentCustomer).getID();
    }

    @OnEvent(component = "form", value = "submit")
    public Object submit1() {
        return onlyWinning;
    }
}
